<template>
  <div id="app">
   
    <router-view v-if="isRouterAlive"/>
  </div>
</template>

<script>
export default {
  name: 'app',
  components: {},
  data(){
    return{
      isRouterAlive:true
    }
  },
  provide(){
    return{
      reload:this.reload,
      demo:'haha'
    }
  },
  methods:{
    reload() {
            this.isRouterAlive = false;
            this.$nextTick(() => {
                this.isRouterAlive = true;
            });
        },
  },
  watch: {
    '$route': function(to,from){
　    document.body.scrollTop = 0
      document.documentElement.scrollTop = 0
    }
},
     beforeDestroy(){
       localStorage.removeItem('navIndex')
  },
}
</script>

<style>

</style>
